﻿@namespace ThingsGateway.Gateway.Razor
@using ThingsGateway.Admin.Application
@using ThingsGateway.Admin.Razor
@using ThingsGateway.Debug
@using ThingsGateway.Gateway.Application
@using ThingsGateway.Extension
@inherits ComponentDefault


<div class="device">
    @if (Item.CurrentDevice is CollectDeviceRunTime collectDeviceRunTime)
    {
        <EditorFormObject Model=@collectDeviceRunTime AutoGenerateAllItem=false IsDisplay LabelWidth="80"  RowType="RowType.Inline" ItemsPerRow="3" ShowLabelTooltip="true">

            <FieldItems>

                <EditorItem Field=@context.ActiveTime FieldExpression=@(()=> context.ActiveTime ) />
                <EditorItem Field=@context.ChannelName FieldExpression=@(()=> context.ChannelName ) />
                <EditorItem Field=@context.PluginName FieldExpression=@(()=> context.PluginName ) />
                <EditorItem Field=@context.SourceVariableCount FieldExpression=@(()=> context.SourceVariableCount ) />
                <EditorItem Field=@context.DeviceVariableCount FieldExpression=@(()=> context.DeviceVariableCount ) />
                <EditorItem Field=@context.MethodVariableCount FieldExpression=@(()=> context.MethodVariableCount ) />
                <EditorItem Field=@context.LastErrorMessage FieldExpression=@(()=> context.LastErrorMessage ) Rows="1" ShowLabelTooltip="false" >
                    <EditTemplate Context="value">
                            <Display Value=@value.LastErrorMessage ValueExpression=@(()=> context.LastErrorMessage ) ShowTooltip class="red--text" ShowLabel="true"/>
                    </EditTemplate>
                </EditorItem>


            </FieldItems>

        </EditorFormObject>
    }
    else
    {
        <EditorFormObject Model=@Item.CurrentDevice AutoGenerateAllItem=false IsDisplay LabelWidth="80"   RowType="RowType.Inline" ItemsPerRow="3" ShowLabelTooltip="true">
            <FieldItems>
                <EditorItem Field=@context.ActiveTime FieldExpression=@(()=> context.ActiveTime ) />
                <EditorItem Field=@context.PluginName FieldExpression=@(()=> context.PluginName ) />
                <EditorItem Field=@context.DeviceVariableCount FieldExpression=@(()=> context.DeviceVariableCount ) />
                <EditorItem Field=@context.LastErrorMessage FieldExpression=@(()=> context.LastErrorMessage ) Rows="1" ShowLabelTooltip="false">
                    <EditTemplate Context="value">
                            <Display Value=@value.LastErrorMessage ValueExpression=@(()=> context.LastErrorMessage ) ShowTooltip class="red--text" ShowLabel="true" />
                    </EditTemplate>
                </EditorItem>
            </FieldItems>

        </EditorFormObject>

    }


</div>
